﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace Model
{
    [Serializable]
    public partial class Ord4a00
    {
		private string _docno;
        private DateTime? _mdate;
		private string _comcode;
		private string _comname;
		private string _slistid;
		private string _splistid;
        private DateTime? _ordate;
        private int? _tranday;
        private DateTime? _reqdate;
		private string _tlistid;
		private string _tranid;
		private string _storageid;
        private int? _status;
		private double _ordmat;
		private double _accamt;
		private double _gainamt;
		private double _gainpct;
		private double _dutyamt;
        private int? _audstatus;
		private double _agio1;
		private double _agio2;
		private double _agio3;
		private string _remark1;
		private string _remark2;
		private string _muser;
		private string _listid;
		private string _taxid;
		private double _adjtotalqty;
		private double _adjtotalamt;
        private DateTime? _instockdate;
		private string _outerdocno;
		
        /// <summary>
        /// 退单号
        /// </summary>
		public string Docno
		{
			get { return _docno;	 }
			set { _docno=value;	}
		}
        /// <summary>
        /// 退单日期
        /// </summary>
		public DateTime? Mdate
		{
			get { return _mdate;	 }
			set { _mdate=value;	}
		}
        /// <summary>
        /// 公司代码
        /// </summary>
		public string Comcode
		{
			get { return _comcode;	 }
			set { _comcode=value;	}
		}
        /// <summary>
        /// 公司名称
        /// </summary>
		public string Comname
		{
			get { return _comname;	 }
			set { _comname=value;	}
		}
        /// <summary>
        /// 销售商主键
        /// </summary>
		public string Slistid
		{
			get { return _slistid;	 }
			set { _slistid=value;	}
		}
        /// <summary>
        /// 门店主键
        /// </summary>
		public string Splistid
		{
			get { return _splistid;	 }
			set { _splistid=value;	}
		}
        /// <summary>
        /// 预退货日期
        /// </summary>
		public DateTime? Ordate
		{
			get { return _ordate;	 }
			set { _ordate=value;	}
		}
        /// <summary>
        /// 送货天数
        /// </summary>
		public int? Tranday
		{
			get { return _tranday;	 }
			set { _tranday=value;	}
		}
        /// <summary>
        /// 应退日期
        /// </summary>
		public DateTime? Reqdate
		{
			get { return _reqdate;	 }
			set { _reqdate=value;	}
		}
        /// <summary>
        /// 送货地址主键
        /// </summary>
		public string Tlistid
		{
			get { return _tlistid;	 }
			set { _tlistid=value;	}
		}
        /// <summary>
        /// 物流
        /// </summary>
		public string Tranid
		{
			get { return _tranid;	 }
			set { _tranid=value;	}
		}
        /// <summary>
        /// 退回仓库
        /// </summary>
		public string Storageid
		{
			get { return _storageid;	 }
			set { _storageid=value;	}
		}
        /// <summary>
        /// 单据状态
        /// </summary>
		public int? Status
		{
			get { return _status;	 }
			set { _status=value;	}
		}
        /// <summary>
        /// 退货总额
        /// </summary>
		public double Ordmat
		{
			get { return _ordmat;	 }
			set { _ordmat=value;	}
		}
        /// <summary>
        /// 实退总额
        /// </summary>
		public double Accamt
		{
			get { return _accamt;	 }
			set { _accamt=value;	}
		}
        /// <summary>
        /// 毛利总额
        /// </summary>
		public double Gainamt
		{
			get { return _gainamt;	 }
			set { _gainamt=value;	}
		}
        /// <summary>
        /// 毛利率
        /// </summary>
		public double Gainpct
		{
			get { return _gainpct;	 }
			set { _gainpct=value;	}
		}
        /// <summary>
        /// 税额
        /// </summary>
		public double Dutyamt
		{
			get { return _dutyamt;	 }
			set { _dutyamt=value;	}
		}
        /// <summary>
        /// 订单审核状态
        /// </summary>
		public int? Audstatus
		{
			get { return _audstatus;	 }
			set { _audstatus=value;	}
		}
        /// <summary>
        /// 折扣1
        /// </summary>
		public double Agio1
		{
			get { return _agio1;	 }
			set { _agio1=value;	}
		}
        /// <summary>
        /// 折扣2
        /// </summary>
		public double Agio2
		{
			get { return _agio2;	 }
			set { _agio2=value;	}
		}
        /// <summary>
        /// 折扣3
        /// </summary>
		public double Agio3
		{
			get { return _agio3;	 }
			set { _agio3=value;	}
		}
        /// <summary>
        /// 备注1
        /// </summary>
		public string Remark1
		{
			get { return _remark1;	 }
			set { _remark1=value;	}
		}
        /// <summary>
        /// 备注2
        /// </summary>
		public string Remark2
		{
			get { return _remark2;	 }
			set { _remark2=value;	}
		}
        /// <summary>
        /// 用户名
        /// </summary>
		public string Muser
		{
			get { return _muser;	 }
			set { _muser=value;	}
		}
        /// <summary>
        /// 主键标识
        /// </summary>
		public string Listid
		{
			get { return _listid;	 }
			set { _listid=value;	}
		}
        /// <summary>
        /// 
        /// </summary>
		public string Taxid
		{
			get { return _taxid;	 }
			set { _taxid=value;	}
		}
        /// <summary>
        /// 
        /// </summary>
		public double Adjtotalqty
		{
			get { return _adjtotalqty;	 }
			set { _adjtotalqty=value;	}
		}
        /// <summary>
        /// 
        /// </summary>
		public double Adjtotalamt
		{
			get { return _adjtotalamt;	 }
			set { _adjtotalamt=value;	}
		}
        /// <summary>
        /// 入库时间
        /// </summary>
		public DateTime? Instockdate
		{
			get { return _instockdate;	 }
			set { _instockdate=value;	}
		}
        /// <summary>
        /// 外部单号
        /// </summary>
		public string Outerdocno
		{
			get { return _outerdocno;	 }
			set { _outerdocno=value;	}
		}
		
		public static List<Ord4a00> GetOrd4a00ListByDataTable(DataTable dt)
		{
			if(dt == null) return null;
		    List<Ord4a00> list = new List<Ord4a00>();
		   
			foreach(DataRow dr in dt.Rows)
            {
				Ord4a00 model = GetOrd4a00ByDataRow(dr);
				if(null == model) continue;
				
				list.Add(model);
            }
           return list;
		}
		
		public static Ord4a00 GetOrd4a00ByDataRow(DataRow dr)
		{
			Ord4a00 model = new Ord4a00(); //实例化Ord4a00
	
			DataColumnCollection dcc = dr.Table.Columns;

			if (dcc.Contains("docno")&&!(dr["docno"] is System.DBNull))  
				model.Docno = ( string)dr["docno"];
			if (dcc.Contains("mdate")&&!(dr["mdate"] is System.DBNull))  
				model.Mdate = ( DateTime)dr["mdate"];
			if (dcc.Contains("comcode")&&!(dr["comcode"] is System.DBNull))  
				model.Comcode = ( string)dr["comcode"];
			if (dcc.Contains("comname")&&!(dr["comname"] is System.DBNull))  
				model.Comname = ( string)dr["comname"];
			if (dcc.Contains("slistid")&&!(dr["slistid"] is System.DBNull))  
				model.Slistid = ( string)dr["slistid"];
			if (dcc.Contains("splistid")&&!(dr["splistid"] is System.DBNull))  
				model.Splistid = ( string)dr["splistid"];
			if (dcc.Contains("ordate")&&!(dr["ordate"] is System.DBNull))  
				model.Ordate = ( DateTime)dr["ordate"];
			if (dcc.Contains("tranday")&&!(dr["tranday"] is System.DBNull))  
				model.Tranday = ( int)dr["tranday"];
			if (dcc.Contains("reqdate")&&!(dr["reqdate"] is System.DBNull))  
				model.Reqdate = ( DateTime)dr["reqdate"];
			if (dcc.Contains("tlistid")&&!(dr["tlistid"] is System.DBNull))  
				model.Tlistid = ( string)dr["tlistid"];
			if (dcc.Contains("tranid")&&!(dr["tranid"] is System.DBNull))  
				model.Tranid = ( string)dr["tranid"];
			if (dcc.Contains("storageid")&&!(dr["storageid"] is System.DBNull))  
				model.Storageid = ( string)dr["storageid"];
			if (dcc.Contains("status")&&!(dr["status"] is System.DBNull))  
				model.Status = ( int)dr["status"];
			if (dcc.Contains("ordmat")&&!(dr["ordmat"] is System.DBNull))  
				model.Ordmat = Convert.ToDouble(dr["ordmat"]);
			if (dcc.Contains("accamt")&&!(dr["accamt"] is System.DBNull))  
				model.Accamt = Convert.ToDouble(dr["accamt"]);
			if (dcc.Contains("gainamt")&&!(dr["gainamt"] is System.DBNull))  
				model.Gainamt = Convert.ToDouble(dr["gainamt"]);
			if (dcc.Contains("gainpct")&&!(dr["gainpct"] is System.DBNull))  
				model.Gainpct = Convert.ToDouble(dr["gainpct"]);
			if (dcc.Contains("dutyamt")&&!(dr["dutyamt"] is System.DBNull))  
				model.Dutyamt = Convert.ToDouble(dr["dutyamt"]);
			if (dcc.Contains("audstatus")&&!(dr["audstatus"] is System.DBNull))  
				model.Audstatus = ( int)dr["audstatus"];
			if (dcc.Contains("agio1")&&!(dr["agio1"] is System.DBNull))  
				model.Agio1 = Convert.ToDouble(dr["agio1"]);
			if (dcc.Contains("agio2")&&!(dr["agio2"] is System.DBNull))  
				model.Agio2 = Convert.ToDouble(dr["agio2"]);
			if (dcc.Contains("agio3")&&!(dr["agio3"] is System.DBNull))  
				model.Agio3 = Convert.ToDouble(dr["agio3"]);
			if (dcc.Contains("remark1")&&!(dr["remark1"] is System.DBNull))  
				model.Remark1 = ( string)dr["remark1"];
			if (dcc.Contains("remark2")&&!(dr["remark2"] is System.DBNull))  
				model.Remark2 = ( string)dr["remark2"];
			if (dcc.Contains("muser")&&!(dr["muser"] is System.DBNull))  
				model.Muser = ( string)dr["muser"];
			if (dcc.Contains("listid")&&!(dr["listid"] is System.DBNull))  
				model.Listid = ( string)dr["listid"];
			if (dcc.Contains("taxid")&&!(dr["taxid"] is System.DBNull))  
				model.Taxid = ( string)dr["taxid"];
			if (dcc.Contains("adjtotalqty")&&!(dr["adjtotalqty"] is System.DBNull))  
				model.Adjtotalqty = Convert.ToDouble(dr["adjtotalqty"]);
			if (dcc.Contains("adjtotalamt")&&!(dr["adjtotalamt"] is System.DBNull))  
				model.Adjtotalamt = Convert.ToDouble(dr["adjtotalamt"]);
			if (dcc.Contains("instockdate")&&!(dr["instockdate"] is System.DBNull))  
				model.Instockdate = ( DateTime)dr["instockdate"];
			if (dcc.Contains("outerdocno")&&!(dr["outerdocno"] is System.DBNull))  
				model.Outerdocno = ( string)dr["outerdocno"];
			
			return model;
		}
    }
}
